import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: {
      title: '首页'
    }
  },
  {
    path: '/login',
    name: 'Login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/acount/login.vue'),
    meta: {
      title: '登入页'
    },
    hidden:true,
  },
  {
    path: '/adminIndex',
    name: 'AdminIndex',
    meta: {
      title: '管理总台'
    },
    component: () => import(/* webpackChunkName: "about" */ '../views/Layout/Index.vue'),

    children: [
      {
        path: '/role',
        name: 'Role',
        component: () => import(/* webpackChunkName: "about" */ "../views/admin/Role.vue"),
        meta: {
          title: '角色管理'
        },

      },
      {
        path: '/user',
        name: 'User',
        component: () => import(/* webpackChunkName: "about" */ "../views/admin/User.vue"),
        meta: {
          title: '用户管理'
        },
      },
    ]
  },
  {
    path: '/new',
    name: 'New',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Layout/Index.vue'),
    meta: {
      title: '信息管理'
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
